CSharpTest.Net
Equals(Byte[],Byte[]) Method
See Also  Example Send Feedback Download Help File
CSharpTest.Net.Library Assembly > CSharpTest.Net.Crypto Namespace > BinaryComparer Class > Equals Method : Equals(Byte[],Byte[]) Method

ar1
ar2

Glossary Item Box

returns true if both arrays contain the exact same set of bytes.

Syntax

Visual Basic (Declaration) 
Public Overloads Shared Function Equals( _
   ByVal ar1() As Byte, _
   ByVal ar2() As Byte _
) As Boolean
C# 
public static bool Equals( 
   byte[] ar1,
   byte[] ar2
)

Parameters

ar1
ar2

Example

Library/Library.Test/TestBinaryComparer.cs

C#Copy Code
Assert.IsTrue(BinaryComparer.Equals(null, null));
Assert.IsTrue(BinaryComparer.Equals(new byte[] { }, new byte[] { }));
Assert.IsTrue(BinaryComparer.Equals(new byte[] { 1, 2, 3 }, new byte[] { 1, 2, 3 }));

Assert.IsFalse(BinaryComparer.Equals(null, new byte[] { 1, 2, 3 }));
Assert.IsFalse(BinaryComparer.Equals(new byte[] { 1, 2, 3 }, null));
Assert.IsFalse(BinaryComparer.Equals(new byte[] { 1, 2 }, new byte[] { 1, 2, 3 }));
Assert.IsFalse(BinaryComparer.Equals(new byte[] { 1, 2, 3 }, new byte[] { 1, 2 }));
VB.NETCopy Code
Assert.IsTrue(BinaryComparer.Equals(Nothing, Nothing))
Assert.IsTrue(BinaryComparer.Equals(New Byte() {}, New Byte() {}))
Assert.IsTrue(BinaryComparer.Equals(New Byte() {1, 2, 3}, New Byte() {1, 2, 3}))

Assert.IsFalse(BinaryComparer.Equals(Nothing, New Byte() {1, 2, 3}))
Assert.IsFalse(BinaryComparer.Equals(New Byte() {1, 2, 3}, Nothing))
Assert.IsFalse(BinaryComparer.Equals(New Byte() {1, 2}, New Byte() {1, 2, 3}))
Assert.IsFalse(BinaryComparer.Equals(New Byte() {1, 2, 3}, New Byte() {1, 2}))

Requirements

Target Platforms: Windows XP, Windows Server 2003, Windows Vista, Windows Server 2008, Windows 7

See Also

Generated with Document! X 2011 by Innovasys